<!--{template admin/header_tpl}-->

<div class="mainarea">
	<div class="maininner">
		<div class="tabs_header">
			<ul class="tabs">
				<li><a href="<!--{eval echo base_url()}-->admin/admin_category/index/"><span>浏览分类</span></a></li>
			</ul>
		</div>
<!--加载数据-->
		<form action="<!--{eval echo base_url()}-->admin/admin_category/edit_category" method="post" accept-charset="utf-8">

			<div class="bdrcontent">
				<table class="formtable" cellspacing="5" cellpadding="5">
						<th style="width:10%;">分类ID</th>
						<th>分类名称</th>
						<th style="width:10%;">显示顺序</th>
						<!--{loop $categories $category}-->
						<tr>
							<td>{$category[catid]}</td>
							<td><input type="text" name="name[{$category[catid]}]" value="{$category[name]}" size="20" maxlength="20" /></td>
							<td><input type="text" name="displayorder[{$category[catid]}]" value="{$category[displayorder]}" size="5" maxlength="5" /></td>
						<tr>
						<!--{/loop}-->
						<tr>
							<td colspan="3"><div><a href="###" onclick="addrow(this, 0)" class="addtr">添加新分类</a></div></td>
						<tr>

					</tr>
				</table>
			</div>
		<!--分页表单和删除按钮-->
			<div class="footactions">
				<input type="submit" name="batchsubmit" value="提交更新" class="submit">
			</div>
		</form>
	</div>
</div>
<div class="side">
	<!--{template admin/side}-->
</div>
<script type="text/javascript">
var rowtypedata = [
	[[1, '<font color="red">新增</font>'], [1,'<input name="newcat[]" value="新分类名称" size="20" type="text" />'], [1, '<input type="text" class="txt" name="newcatorder[]" value="0" size="5"/>']],
];
	var addrowdirect = 0;
	function addrow(obj, type) {
		var table = obj.parentNode.parentNode.parentNode.parentNode;
		if(!addrowdirect) {
			var row = table.insertRow(obj.parentNode.parentNode.parentNode.rowIndex);
		} else {
			var row = table.insertRow(obj.parentNode.parentNode.parentNode.rowIndex + 1);
		}
		var typedata = rowtypedata[type];
		for(var i = 0; i <= typedata.length - 1; i++) {
			var cell = row.insertCell(i);
			cell.colSpan = typedata[i][0];
			var tmp = typedata[i][1];
			if(typedata[i][2]) {
				cell.className = typedata[i][2];
			}
			tmp = tmp.replace(/\{(\d+)\}/g, function($1, $2) {return addrow.arguments[parseInt($2) + 1];});
			cell.innerHTML = tmp;
		}
		addrowdirect = 0;
	}
</script>
<!--{template admin/footer_tpl}-->